package com.net.shop.car.manager.api.volley.response.dingdan;

import org.json.JSONException;
import org.json.JSONObject;

import com.net.shop.car.manager.api.model.DingdanDetail;
import com.net.shop.car.manager.api.volley.Response;
import com.net.shop.car.manager.utils.Constants;
import com.net.shop.car.manager.utils.StringUtils;

public class DingdanDetailResponse extends Response {
	
	private DingdanDetail detail;
	
	public DingdanDetailResponse() {
		super(Constants.DINGDAN_ORDER_DETAIL);
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public String getContentTag() {
		return "detail";
	}
	
	@Override
	public void parseContent(String content) {
		try {
			JSONObject jsonObject = new JSONObject(content);
			detail = new DingdanDetail();
			detail.setCreateDate(StringUtils.filterNull(jsonObject.getString("CREATE_DATE")));
			detail.setGoodName(StringUtils.filterNull(jsonObject.getString("GOOD_NAME")));
			detail.setGoodPrice(StringUtils.filterMoneyNull(jsonObject.getString("ORDER_PRICE")));
			detail.setId(StringUtils.filterNull(jsonObject.getString("ID")));
			detail.setOrderId(StringUtils.filterNull(jsonObject.getString("ORDER_ID")));
			detail.setUuid(StringUtils.filterNull(jsonObject.getString("ORDER_UUID")));
			detail.setSellerId(StringUtils.filterNull(jsonObject.getString("SELLER_ID")));
			detail.setSellerName(StringUtils.filterNull(jsonObject.getString("SELLER_NAME")));
			detail.setOrderState(StringUtils.filterIntegerNull(jsonObject.getString("ORDER_STATE")));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public DingdanDetail getDetail() {
		return detail;
	}

}
